const cloud = require('wx-server-sdk');

cloud.init({
  env: cloud.DYNAMIC_CURRENT_ENV
});
const db = cloud.database();

// 修改数据库信息云函数入口函数
exports.main = async (event, context) => {
  try {
    const res = await db.collection('user').where({
      _openId: event._openId
    }).get()
    return {
      list: res?.data
    };
  } catch (error) {
    return {
      list: []
    }
  }
};